$.fn.bootstrapTableEx = function(opt){
    var defaults = {
        url: '',
        dataField: "rows",
        method: 'post',
        dataType: 'json',
        selectItemName: 'id',
        clickToSelect: true,
        pagination: true,
        smartDisplay: false,
        pageSize: 10,
        pageList: [10, 20, 30, 40, 50],
        paginationPreText: '上一页',
        paginationNextText: '下一页',
        sidePagination: 'server',
        queryParamsType : null,
        columns: []
    }
    var option = $.extend({}, defaults, opt);
    $(this).bootstrapTable(option);
}

isNullOrEmpty = function (obj) {
    if ((typeof (obj) == "string" && obj == "") || obj == null || obj == undefined) {
        return true;
    } else {
        return false;
    }
}

dialogMsg = function(msg, type) {
    var msgType = {
        success:1,
        error:2,
        warn:3,
        info:7
    };
    if(isNullOrEmpty(type)){
        type='info';
    }
    top.layer.msg(msg, {
        icon: msgType[type],
        time: 2000
    });
}

checkedArray = function (id) {
    var isOK = true;
    if (id == undefined || id == "" || id == 'null' || id == 'undefined') {
        isOK = false;
        dialogMsg('您没有选中任何数据项！');
    }
    return isOK;
}

checkedRow = function (id) {
    var isOK = true;
    if (id == undefined || id == "" || id == 'null' || id == 'undefined') {
        isOK = false;
        dialogMsg('您没有选中任何数据项！');
    } else if (id.length > 1) {
        isOK = false;
        dialogMsg('您只能选择一条数据项！');
    }
    return isOK;
}


function GetQueryString(name)
{
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
}